// JavaScript Document

//$(function(){ 
//	$('.search_li').corner('round 8px').parent().css('padding', '2px').corner('round 10px');
//});

//图片效果js--------------
$(function(){
		var x = 10;
		var y = 10;
		$('a.tooltip').mouseover(function(e){
			this.myTitle = this.title;
			this.title = "";
			var tooltip = "<div id='tooltip'>" + this.myTitle + "<\/div>";	
			$('body').append(tooltip);
			$('#tooltip').css({
				top:(e.pageY + y) + "px",
				left:(e.pageX + x) + "px"
			}).show('slow');
		}).mouseout(function(){
			this.title = this.myTitle;
			$('#tooltip').remove();
		}).mousemove(function(e){
			$('#tooltip').css({
				top:(e.pageY + y) + "px",
				left:(e.pageX + x) + "px"
			});
		});	
		
		$('.result_image1 a').mouseover(function(e){
			this.myTitle = this.title;
			this.title = "";
			var imgTitle = this.myTitle? "<span>" + this.myTitle + "</span>" : "";
 
			var tooltip = "<div id='tooltip'><img src='"+ this.href +"' alt=''/>"+ imgTitle +"<\/div>";
			$('body').append(tooltip);
			$('#tooltip').css({
				top:(e.pageY + y) + "px",
				left:(e.pageX + x) + "px",
				opacity:"1"
			}).show('fast');
		}).mouseout(function(){
			this.title = this.myTitle;
			$('#tooltip').remove();
		}).mousemove(function(e){
			$('#tooltip').css({
				top:(e.pageY + y) + "px",
				left:(e.pageX + x) + "px",
				opacity:"1"
			});
		});	
});	

//产品分类js-------------------

/*window.onload = function(){
	$("#selectSub ul li").click(function(){
   $("#address").attr("value",$(this).text());
   });
}*/
jQuery.fn.selectCity = function(targetId) {
	var _seft = this;
	var targetId = $(targetId);

	this.click(function(){
		var A_top = $(this).offset().top + $(this).outerHeight(true);  //  1
		var A_left =  $(this).offset().left;
		targetId.bgiframe();
		targetId.slideDown('fast').css({"position":"absolute","top":A_top+"px" ,"left":A_left+"px"});
	});

	targetId.find("#selectItemClose").click(function(){
		targetId.slideUp('fast');
	});

/*	targetId.find("#selectSub :checkbox").click(function(){		
		targetId.find(":checkbox").attr("checked",false);
		$(this).attr("checked",true);	
		_seft.val( $(this).val() );
		targetId.slideUp('fast');
	});*/
	
	$("#selectSub ul li").click(function(){
    	$("#category").attr("value",$(this).text());
    });
	
	$(document).click(function(event){
		if(event.target.id!=_seft.selector.substring(1)){
			targetId.slideUp('fast');	
		}
	});

/*	targetId.click(function(e){
		e.stopPropagation(); //  2
	});*/

    return this;
}
 
$(function(){
	//test1:
	$("#category").selectCity("#selectItem");
});
